/**路由模块 */
// 1.引入依赖
import { createRouter, createWebHistory } from 'vue-router'


// 2.配置路由规则
// 导入所需组件
import Login from '../views/Login/index.vue'

const routes = [
  {
    path: '/',
    redirect: "/login",
  },
  {
    name: "login",
    path: "/login",
    component: Login,
    meta: {
      title: "管理员登录"
    }
  },
  {
    name: "main",
    path: "/main",
    component: () => import("../views/Main/index.vue"),
    redirect: "/main/home",
    children: [
      {
        name: "home",
        path: "home",
        component: () => import("../views/Home/index.vue"),
        meta: {
          title: "管理首页"
        },
      },
      {
        name: "menus",
        path: "menus",
        component: () => import("../views/Menus/index.vue"),
        meta: {
          title: "菜单管理"
        },
      },
      {
        name: "roles",
        path: "roles",
        component: () => import("../views/Roles/index.vue"),
        meta: {
          title: "角色管理"
        },
      },
      {
        name: "admins",
        path: "admins",
        component: () => import("../views/Admins/index.vue"),
        meta: {
          title: "管理员管理"
        },
      },
      {
        name: "cates",
        path: "cates",
        component: () => import("../views/Cates/index.vue"),
        meta: {
          title: "商品分类管理"
        },
      },
      {
        name: "specs",
        path: "specs",
        component: () => import("../views/Specs/index.vue"),
        meta: {
          title: "商品规格管理"
        },
      },
      {
        name: "goods",
        path: "goods",
        component: () => import("../views/Goods/index.vue"),
        meta: {
          title: "商品管理"
        },
      },
      {
        name: "member",
        path: "member",
        component: () => import("../views/Member/index.vue"),
        meta: {
          title: "会员管理"
        },
      },
      {
        name: "Banners",
        path: "Banners",
        component: () => import("../views/Banners/index.vue"),
        meta: {
          title: "轮播图管理"
        },
      },
      {
        name: "seckills",
        path: "seckills",
        component: () => import("../views/SecKills/index.vue"),
        meta: {
          title: "活动管理"
        },
      },
      {
        name: "404",
        path: "404",
        component: () => import("../views/404/index.vue"),
        meta: {
          title: "404"
        },
      },
    ]
  }
]

// 3.创建路由对象
const router = createRouter({
  // 匹配模式
  history: createWebHistory(),
  // 路由规则
  routes,
  // 相应类名
  linkActiveClass: "active",

})

// 导出路由对象
export default router
